package com.bluedot.www.core.common;

/**
 * 全局异常
 *
 * @author GUOZHIPENG
 * @version 1.0
 * @date 2021/8/8 16:43
 */
public class GlobalException extends RuntimeException {
    private Integer code;

    public GlobalException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public GlobalException(String message, Throwable throwable) {
        super(message, throwable);
    }

    public GlobalException(String message, Integer code, Throwable throwable) {
        super(message, throwable);
        this.code = code;
    }

    public GlobalException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "GlobalException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }

}
